home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: seebs@solutions.solon.com (Peter Seebach)
- Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++,comp.edu
- Subject: Re: ANSI C and POSIX (was Re: C/C++ knocks the crap out of Ada)
- Date: 9 Apr 1996 07:25:36 -0500
- Organization: Usenet Fact Police (Undercover)
- Message-ID: <4kdl00$rv@solutions.solon.com>
- References: <JSA.96Feb16135027@organon.com> <4kb2j8$an0@solutions.solon.com> <4kbrt5$k3h@mulga.cs.mu.OZ.AU> <dewar.829012486@schonberg>
- Reply-To: seebs@solon.com
- NNTP-Posting-Host: solutions.solon.com
-
- In article <dewar.829012486@schonberg>, Robert Dewar <dewar@cs.nyu.edu> wrote:
- >By a "portability problem" most people mean that you take a program
- >written in language X, and try to move it to machine Y from machine Z,
- >and it does not work any more.
-
- Right. No behavior of "i=++i", or of someone twiddling the internals
- of a stdio FILE, can be unportable, because no program doing those is
- written in C. They are portability problems of the language "incorrect
- C", which is beyond the intended scope of comp.lang.c. :)
-
- Really; any time you are writing things not specified in any spec, you
- have left the realm of what that spec guarantees, and nothing that
- happens to you is a portability problem with that spec.
-
- It may be a weakness problem with that spec; C's spec is certainly too
- weak in some areas. But it's possible to implement it on nearly anything,
- which was the goal.
-
- >Portability problems are most definitely caused by writing non-portable
- >code. In fact in the absence of errors in the compiler of environment
- >on machine Y or machine Z, this is the ONLY source of portability
- >problems.
-
- This, we agree on, mostly...
-
- >However, it is definitely the case that languages vary in the ease with
- >which people end up writing non-portable code deliberately or
- >accidentally.
-
- Also very true. I believe it is basically impossible to meaningfully
- write portable machine code. (Exceptions exist; there was a program
- in the IOCCC which worked on a VAX *or* a PDP.)
-
- >For example, in C, we can't declare an integer variable without
- >introducing a potential portability dpeendence on the range. Careful
- >writing can get around this, or certainly minimize it, but it's often
- >the source of porability problems. Typical Ada prograns do not suffer
- >from this particular problem, because even a novice Ada programmer
- >knows to avoid the use of predefined types in code that is intended
- >to be portable.
-
- This is a known limitation of C, and may be addressed by C9X. I hope
- it is; it's one of the few areas where I feel the language is fundementally
- incapable of doing what I want it to do.
-
- Luckily, it doesn't affect most of what I'm working on these days.
-
- -s
- --
- Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
- C/Unix wizard -- C/Unix questions? Send mail for help. No, really!
- FUCK the communications decency act. Goddamned government. [literally.]
- The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
-